package com.ljm.boot.helloword.letCode;

public class Test11 {

    public static int maxArea(int[] height) {
        if(height.length==0){
            return 0;
        }
        if(height.length==1){
            return 0;
        }
        int maxArea = 0,left  = 0;
        int right  = height.length-1;

        while(left<right){
            int area = Math.min(height[left],height[right]) *(right-left);
            maxArea = Math.max(maxArea,area);
            System.out.println(left+"-"+right+"-"+area);
            if(height[left]>height[right]){
                right--;
            }else{
                left++;
            }

        }
        return maxArea;
    }

    public static void main(String[] args) {
        System.out.println(maxArea(new int[]{0,1,8,10,4,5,6,9,8}));;
    }
}
